package fzu.functiongather.QRCode;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.xys.libzxing.zxing.activity.CaptureActivity;

import fzu.functiongather.R;

/**
 * Created by WLT on 2016/7/15.
 */
public class QRCodeActivity extends Activity{
    private TextView mTvResult;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.qrcode_main);
        mTvResult=(TextView)findViewById(R.id.tv_result);
    }
    public void scan(View view){
        startActivityForResult(new Intent(QRCodeActivity.this,CaptureActivity.class),0);//使用第三方类库libzxing
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if(resultCode==RESULT_OK){
            Bundle bundle=data.getExtras();
            String result = bundle.getString("result");
            mTvResult.setText(result);
        }
    }
}
